package com.tedu.sp02.service;
/*
 商品服务的实现类
 */
import com.tedu.sp01.entity.Item;
import com.tedu.sp01.service.ItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
@Slf4j
public class ItemServiceImpl implements ItemService {
    @Override
    public List<Item> getItem(String orderId) {
        log.info("orderId="+orderId);
        List<Item> items = new ArrayList<>();
       items.add(new Item(1, "商品1", 1));
       items.add(new Item(2, "商品2", 2));
       items.add(new Item(3, "商品3", 3));
       items.add(new Item(4, "商品4", 4));
       items.add(new Item(5, "商品5", 5));
        return items;
    }

    @Override
    public void decreaseNumbers(List<Item> items) {
        for (Item i:items
             ) {
            log.info("减少库存："+i);
        }
    }
}
